<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <%@include file="../includes/common.jsp" %>
    <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
    <%@ page contentType="text/html;charset=UTF-8" %>

    <title>课件上传列表</title>
</head>
<body>
<div class="container-fluid" style="padding: 0">
    <div class="row-fluid">
        <div style="padding: 10px">
            <table id="dataTable"></table>
            <div id="dataEdit" closed="true" modal="true" style="overflow: hidden">
                <iframe style="width: 100%;height: 100%"
                        id="contentFrame"
                        name="contentFrame"
                        marginheight="0"
                        marginwidth="0"
                        frameborder="0" src=""
                        allowTransparency="true">
                </iframe>
            </div>
        </div>
    </div>
</div>
</body>
</html>

<script type="text/javascript">
    function query() {
        listOption.url = basePath+"consumer/friendCourse";
        listOption.data = "";
        listOption.pageNumber = 1;
        loadData(listOption);
    }

    function initDataGrid() {
        $('#dataTable').datagrid({
            title: "课件列表",
            pagination: true,
            fitColumns: true,
            columns: [
                [
                    {field: 'loginName', title: '好友账号', sortable: true, align: 'center', width: 300},
                    {field: 'scormName', title: '课件名称', sortable: true, align: 'center', width: 300},
                    {field: 'showCourseType', title: '课件类别', sortable: true, align: 'center', width: 200},
                    {field: 'uploadTime', title: '上传时间', align: 'center', width: 300},
                    {field: 'courseDisc', title: '课程描述', align: 'center', width: 300},
                    {field: 'registNum', title: '注册量', align: 'center', width: 100} ,
                    {field: 'edit', title: '操作', align: 'center', width: 200}
                ]
            ],
            sortName: "",
            sortOrder: ""

        });
    }



    function format(data) {
        data.resultList = queryFormat(data.resultList);
        return data;
    }

    function queryFormat(temp) {
        var rowDataList = [];
        for (var i in temp) {
            idBtn = "&nbsp;<input type='checkbox' name='deleteUserCheckBox' id='" + temp[i].id + "' value='" + temp[i].id + "'\">&nbsp;";
            editBtn = "&nbsp;<a onclick='studyCourse(\"" + temp[i].id + "\")'>学习</a>&nbsp;";
            temp[i].id = idBtn;
            temp[i].edit = editBtn;
            rowDataList.push(temp[i]);
        }
        return rowDataList;
    }

    function studyCourse(id){

         window.location.href=basePath+"scormZip/playScorm?id="+id;
    }

    $(function () {
        initDataGrid();
        query();
    });
</script>